﻿using CocoaAni.Net.WebSockets.Server.ArgAdapters;

namespace CocoaAni.Net.WebSockets.Server.Configs;

public class WebSocketServiceConfig
{
    public static WebSocketServiceConfig Default { get; set; } = new WebSocketServiceConfig()
    {
        ClientReceiveBufferSize = 10240,
        ClientSendBufferSize = 10240,
    };

    public WebSocketServiceConfig()
    {
        JsonObjectArgAdapter = new JsonObjectArgAdapter();
        JsonPropertiesArgAdapter = new JsonObjectPropertiesArgAdapter();
        MessageTextArgAdapter = new MessageTextArgAdapter();
        BinaryArgAdapter = new BinaryArgAdapter();
        ParameterErrorResponse = "{\"code\": -1,\"message\": \"参数错误！\"}";
        Url = new Uri("ws://localhost:30213");
        ListenBacklog = 20;
        ClientReceiveBufferSize = 10240;
        ClientSendBufferSize = 10240;
    }

    public int ClientReceiveBufferSize { get; set; }
    public int ClientSendBufferSize { get; set; }
    public Uri Url { get; set; }
    public int ListenBacklog { get; set; }
    public object ParameterErrorResponse { get; set; }
    public JsonObjectArgAdapter JsonObjectArgAdapter { get; set; }
    public JsonObjectPropertiesArgAdapter JsonPropertiesArgAdapter { get; set; }
    public MessageTextArgAdapter MessageTextArgAdapter { get; set; }
    public BinaryArgAdapter BinaryArgAdapter { get; set; }
}